package com.xuecheng.content.controller;

import com.xuecheng.commons.model.dto.CourseTeacherDto;
import com.xuecheng.commons.model.vo.ResponseResult;
import org.springframework.web.bind.annotation.*;
import com.xuecheng.content.service.CourseTeacherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 * 课程-教师关系表前端控制器
 * </p>
 *
 * @author itheima
 */
@Slf4j
@RestController
public class CourseTeacherController {

    @Autowired
    private CourseTeacherService  courseTeacherService;

    @GetMapping("/courseTeacher/list/{courseId}")
    public ResponseResult getTeacherListById(@PathVariable Long courseId){
        return courseTeacherService.getTeacherListById(courseId);
    }

    @PostMapping("/courseTeacher")
    public ResponseResult saveCourseTeacher(@RequestBody CourseTeacherDto courseTeacherDto){
        return courseTeacherService.saveCourseTeacher(courseTeacherDto);
    }

    @DeleteMapping("/courseTeacher/course/{courseId}/{teacherId}")
    public ResponseResult deleteTeacher(@PathVariable("courseId") Long courseId,@PathVariable("teacherId") Long teacherId){
        return courseTeacherService.deleteTeacher(courseId,teacherId);
    }
}
